home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Programming / MuManual / Include / mmu / context.i < prev    next >
Text File  |  2000-04-02  |  8KB  |  201 lines

  1.         IFND MMU_CONTEXT_I
  2. MMU_CONTEXT_I   SET     1
  3. ;*************************************************************************
  4. ;** mmu.library                                                         **
  5. ;**                                                                     **
  6. ;** a system library for arbitration and control of the MC68K MMUs      **
  7. ;**                                                                     **
  8. ;** © 1998 THOR-Software, Thomas Richter                                **
  9. ;** No commercial use, reassembly, modification without prior, written  **
  10. ;** permission of the authors.                                          **
  11. ;** Including this library in any commercial software REQUIRES a        **
  12. ;** written permission and the payment of a small fee.                  **
  13. ;**                                                                     **
  14. ;**---------------------------------------------------------------------**
  15. ;** context related definitions                                         **
  16. ;**                                     **
  17. ;** $VER: 40.50 (31.10.99)                        **
  18. ;*************************************************************************
  19.  
  20.         IFND EXEC_TYPES_I
  21.         INCLUDE "exec/types.i"
  22.         ENDC
  23.  
  24. ;* A context keeps roughly speaking an MMU table. Lovers of unix might
  25. ;* want to use the name "process" instead, whereas an exec task or
  26. ;* a dos.library process might be called "a thread".
  27. ;* All tasks sharing one context share one logical addressing space. *
  28.  
  29. ;* The definition of the context structure: This is something you do
  30. ;* not care about. *
  31.  
  32.         STRUCTURE MMUContext,0
  33.         APTR    ctx_succ                ;struct MMUContext *
  34.         APTR    ctx_pred                ;struct MMUContext *
  35.         ;* private data here. Do not touch, modify, .... *
  36.         LABEL ctx_SIZE
  37.  
  38.  
  39. ;* A mapping node, used to define the address space. This is what you find
  40. ;* in the list arbitrated by GetMapping().
  41.  
  42. ;* This structure is stricly READ ONLY *
  43.  
  44.         STRUCT MappingNode,0
  45.         APTR    map_succ                ;struct MappingNode *
  46.         APTR    map_pred                ;struct MappingNode *
  47.         
  48.         ULONG   map_Lower               ;* lower address this node covers. *
  49.         ULONG   map_Higher              ;* higher address, inclusive *
  50.         ULONG   map_Flags               ;* internal use only. *
  51.         ULONG   map_Properties          ;* see below for definitions *
  52.  
  53.         ;* the next one is a big union. All entries share the same location
  54.         LABEL   map_UserData            ;* your data if this is invalid or swapped *
  55.         LABEL   map_Page;               ;* destination page if bundled *
  56.         LABEL   map_Descriptor          ;* pointer to a descriptor, alternatively *
  57.         LONG    map_Delta               ;* added to the logical address if remapped *
  58.  
  59.         LABEL   map_SIZE
  60.  
  61.  
  62.  
  63. ;* Property types:
  64. ;* These define the "property flags" you may assign to memory with
  65. ;* SetProperties() and SetPageProperties(). *
  66.  
  67. MAPP_WRITEPROTECTED     equ     (1<<2)
  68. ;* The region is write protected and the segmentation fault exception hooks
  69. ;* will be called on a write access. *
  70.  
  71. MAPP_USED               equ     (1<<3)
  72. ;* Set by the MMU on access, querried by GetPageProperties(). *
  73.  
  74. MAPP_MODIFIED           equ     (1<<4)
  75. ;* Set by the MMU on write accesses, querried by GetPageProperties(). *
  76.  
  77. MAPP_CACHEINHIBIT       equ     (1<<6)
  78. ;* Region is cache-inhibited, by default serialized access, precise
  79. ;* exception mode *
  80.  
  81. MAPP_SUPERVISORONLY     equ     (1<<7)
  82. ;* Supervisor access only. Note that this is currently implemented by
  83. ;* marking the pages as invalid in the user MMU tables, not by setting
  84. ;* the supervisor bit. *
  85.  
  86. MAPP_USERPAGE0          equ     (1<<8)
  87. ;* User page attribute 0, used only by 68040, 68060.
  88. ;* These bits are available at special pins of the CPU,
  89. ;* special hardware might require this. *
  90.  
  91. MAPP_USERPAGE1          equ     (1<<9)
  92. ;* User page attribute 1 *
  93.  
  94. MAPP_GLOBAL             equ     (1<<10)
  95. ;* This memory region is global. The MMU library makes currently no
  96. ;* effective use of this flag, and it makes only a difference for the
  97. ;* 040 and 060 anyhow. *
  98.  
  99. MAPP_BLANK              equ     (1<<11)
  100. ;* There's no memory here. If accessed, the access is quietly tolerated,
  101. ;* even though nothing useful should be expected. This is mainly to work
  102. ;* around bad software if no enforcer is available. *
  103.  
  104. MAPP_SINGLEPAGE         equ     (1<<12)
  105. ;* Give this page a private page descriptor. This flag IS A MUST
  106. ;* if you want to use GetPagePropertiesA/SetPagePropertiesA on
  107. ;* that page.  *
  108.  
  109. MAPP_COPYBACK           equ     (1<<13)
  110. ;* MC68040 or MC68060 advanced copyback mode enabled. The library sets this
  111. ;* by default for all non-chip memory. *
  112.  
  113. MAPP_INVALID            equ     (1<<14)
  114. ;* The page is invalid. Accessing it results in a segmentation fault, i.e.
  115. ;* the library will call the appropriate exception hooks. *
  116.  
  117. MAPP_REMAPPED           equ     (1<<15)
  118. ;* Page is redirected to a different memory region. Note that you MUST NOT
  119. ;* add this memory to the exec library free memory list because some DMA
  120. ;* devices don't support I/O from this region and the MMU library will
  121. ;* guru as soon as you try to place MMU tables in remapped memory.
  122. ;* This might change in the future. *
  123.  
  124. MAPP_SWAPPED            equ     (1<<16)
  125. ;* This page is currently swapped out. If a program accesses this, a
  126. ;* swapped-out fault is generated. UserData is available for a swapper
  127. ;* daemon, usually the memory.library. *
  128.  
  129. MAPP_ROM                equ     (1<<17)
  130. ;* This is read-only memory, but the library tolerates write accesses
  131. ;* quietly and no hook is called on writes. Hence, this turns the memory
  132. ;* region effectively into a "ROM". *
  133.  
  134. MAPP_SHARED             equ     (1<<18)
  135. ;* Shares the table of the global NULL context. This is currently not
  136. ;* implemented and should not be set. *
  137.  
  138. MAPP_TRANSLATED         equ     (1<<19)
  139. ;* This memory region is - probably partially - under control of the
  140. ;* transparent translation registers and should not be touched.
  141. ;* The mmu library does not handle the transparent translation very well
  142. ;* and tries to get rid of them on startup. *
  143.  
  144. MAPP_REPAIRABLE         equ     (1<<20)
  145. ;* This flag allows invalid or write protected pages to get repaired on
  146. ;* a fault by software rather than by swapping in a page.
  147. ;* The mmu.library will try to make the written data available to the
  148. ;* exception hook, and will try to provide readback data for the input
  149. ;* pipeline of the CPU. Note that this is very useful for debugging tools
  150. ;* and the like, but causes quite a lot of overhead.
  151. ;* Furthermore, MAPP_REPAIRABLE pages do not get user data. *
  152.  
  153. MAPP_IMPRECISE          equ     (1<<21)
  154. ;* If non-cacheable, allow imprecise exception mode *
  155.  
  156. MAPP_INDIRECT           equ     (1<<22)
  157. ;* Indirect table pointer to a user-provided table. Note that the mmu library
  158. ;* exception handler returns always a pointer to the descriptor pointing to
  159. ;* your descriptor, not to your descriptor directly. *
  160.  
  161. MAPP_BUNDLED            equ     (1<<23)
  162. ;* Several pages bundled to one physical page in memory, usually done to
  163. ;* map out memory. *
  164.  
  165. MAPP_USER0              equ     (1<<24)
  166. MAPP_USER1              equ     (1<<25)
  167. MAPP_USER2              equ     (1<<26)
  168. MAPP_USER3              equ     (1<<27)
  169. ;* Strictly for you. Not touched by the library. *
  170.  
  171. MAPP_NONSERIALIZED      equ     (1<<29)
  172. ;* If non-cacheable, allow non-serialized access *
  173.  
  174. MAPP_IO               equ    (1<<30)
  175. ;* I/O hardware. Avoid reading/writing this if you can avoid it. *
  176.  
  177.  
  178. ;* error codes CreateMMUContext may generate: *
  179.  
  180. CCERR_TRIMMED            equ    1
  181. ;* The MMU table has been trimmed to keep care about the enlarged 
  182. ;* table size. THIS IS NOT AN ERROR. *
  183.  
  184. CCERR_UNALIGNED            equ    3    
  185. ;* The MMU library had to perform some heavy rounding, as for
  186. ;* example to MAPP_REMAPPED pages. Therefore, the mapping 
  187. ;* might be partially wrong. You possibly do not want to use
  188. ;* this setup. *
  189.  
  190. CCERR_NO_FREE_STORE        equ    103
  191. ;* Out of memory. *
  192.  
  193. CCERR_INVALID_PARAMETERS    equ    513
  194. ;* Specified parameters are invalid. *
  195.  
  196. CCERR_UNSUPPORTED        equ    514         
  197. ;* The parameters are valid, but not supported by the 
  198. ;* available hardware. *
  199.  
  200.         ENDC    ;       MMU_CONTEXT_I
  201.